package com.springapp.mvc;

import com.springapp.mvc.utils.PropertyUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/")
public class HelloController {

    Logger logger = LoggerFactory.getLogger(HelloController.class);

    @RequestMapping(method = RequestMethod.GET)
    public String printWelcome(HttpServletRequest request,ModelMap model) {
        model.addAttribute("message", "Hello world!");
        return "hello";
    }

    @ResponseBody
    @RequestMapping(value = "test.do")
    public List testAjax(HttpServletRequest request) {
        List<Object> lists = new ArrayList<Object>();
        lists.add("3434");
        lists.add("四道");
        lists.add(new String[]{"a", "b"});
        return lists;
    }
}